# 复制整行： Ctrl + D
# 格式化：Ctrl + Alt + L
# 整体标注：Ctrl + /


"""
list
"""

# 列表内是否必须是同一类型，非也。
list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in list1:
    print(i)

list2 = [1, True, 3, 4.5, 5, 6, 7, 8, "1"]
for i in list2:
    print(i)
    print(type(i))

# 多维列表遍历
print(f"多维列表")
list3 = [1, 2, 3, 4, 5, 6, 7, 8, [1, 2, 3], 9]
i = 0
while i < len(list3):
    print(list3[i])
    i += 1




"""
tuples
"""
print("-"*40)
tuple1 = (1, 2, 3, 4, 5, 6, 7, 8, 9)


"""
strings
"""
str1 = "abc"
for i in str1:
    print(i)


# slice
print("="*40)
str_slice = str1[0:2]
print(str_slice)

str_slice2 = tuple1[2:6]
print(str_slice2)

str_slice3 = list2[1:3]
print(str_slice3)

"""
set
"""
#集合取出的值有一套独立的算法
print("="*40)
set1 = {100,200,300,400,500}
print(set1)

set2 = {1,2,3,4,5,6,7,8,9}
print(set2)

for i in set1:
    print(i)

#空集合

set_A = {1,2,3,4,5,6,7,8,9}
set_B = set()
set_C = {1,2,3,4,5,6,7,8,9}
print(set_A)
print(set_B)
print()


"""
dictionary
"""
print("="*40)
dict_A = {1: 'a', 2: 'b', 3: 'c', 4: 'd'}
print(dict_A)


#遍历所有value
for i in dict_A.keys():
    print(dict_A[i])
print("-"*40)

for i in dict_A.values():
    print(i)
print("="*40)

for k,v in dict_A.items():
    print(k, v)






